<script setup>

</script>

<template>
  <div class="body-content">
    <!-- 第一行 -->
    <div>
      <div class="title">
        图像增强
      </div>
      <div class="line">
        <el-steps :active="4" align-center>
        <el-step title="频域增强参数设置"/>
        <el-step title="增强图像筛选"/>
        <el-step title="图像生成参数设置"/>
        <el-step title="生成图像筛选"/>
      </el-steps>
      </div>
    </div>
    <!-- 第二行 -->
    <div>
      <el-row>
        <div class="first-box">
        <div class="box-title">
          1.频域增强参数设置1
        </div>
        <div>
          <div class="laber">
    <div class="input-columns">
      <div class="input-column">
        <div class="input-container">
          <label class="input-lable">数据集</label>
            <select class="model-select-data">
              <option value="DAGA" selected>DAGA</option>
              <option value="AAPD" >AAPD</option>
              <option value="KolektorSDD2" >KolektorSDD2</option>
              <option value="MTD" >MTD</option>
           
          </select>
        </div>
        <div class="input-container">
          <label class="input-lable">频域加强</label>
          <select class="model-select-data">
              <option value="yes" selected>是</option>
              <option value="No" >否</option>
           
          </select>
        </div>
        <div class="input-container">
          <label class="input-lable">随机旋转</label>
          <div class="input-box">
            <input type="text"  class="input-field" placeholder="0-180">
          </div>
        </div>
        <div class="input-container">
          <label class="input-lable">裁剪缩放</label>
          <div class="input-box">
            <input type="text"  class="input-field" placeholder="0.6">
          </div>
        </div>
      </div>
      <div class="input-column">
        <div class="input-container">
          <label class="input-lable">亮度调整</label>
          <div class="input-box">
            <input type="text"  class="input-field" placeholder="0.6">
          </div>
        </div>
        <div class="input-container">
          <label class="input-lable">图像翻转</label>
          <div class="input-box">
            <input type="text"  class="input-field" placeholder="0.7">
          </div>
        </div>
        <div class="input-container">
          <label class="input-lable">增加噪声</label>
          <div class="input-box">
            <input type="text"  class="input-field" placeholder="0.65">
          </div>
        </div>
        <div class="input-container">
          <label class="input-lable">生成张数</label>
          <div class="input-box">
            <input type="text"  class="input-field" placeholder="200">
          </div>
        </div>
      </div>
    </div>
  </div>
        </div>
         <el-button type="success" @click="onclick1">开始增强</el-button>
       </div>
       <!-- 第二个 -->
      <div class="second-box">
        <div class="box-title">
          2. 增强图像筛选
        </div>
        <div class="detailed-content">
          <!-- 左侧部分，占据2/5 -->
          <div class="left-content">
            <div>
              <div class="box-blue3" style="margin-top: 40px;"> 
              <img style="width: 200px;height: 200px;
  margin: 10px 40px;"   :src="url1" />
              <!-- <img class="inner-button2" :src="selectedImageUrl" /> -->
            </div>
            <div class="box-title" style="margin-top: 40px;" >
              增强图像展示
            </div>
          </div>
          </div>
          <!-- 右侧部分，占据3/5 -->
          <div class="right-content">
            <!-- 第一行，水平居中显示的图像生成记录 -->
            <div class="box-title">
              图像增强记录
            </div>
            <!-- 表格 -->
<!--            <table class="image-table">-->
<!--              <thead>-->
<!--                <tr class="deep-blue-row">-->
<!--                  <th>序号</th>-->
<!--                  <th>图像名</th>-->
<!--                  <th>生成时间</th>-->
<!--                </tr>-->
<!--              </thead>-->
<!--              <tbody>-->
<!--                &lt;!&ndash; 三行空着 &ndash;&gt;-->
<!--                <tr></tr>-->
<!--                <tr></tr>-->
<!--                <tr></tr>-->
<!--                &lt;!&ndash; 表头为蓝色，下面一行蓝色一行白色的间隔颜色，内容为空 &ndash;&gt;-->
<!--                <tr class="blue-row">-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                </tr>-->
<!--                <tr class="white-row">-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                </tr>-->
<!--                <tr class="blue-row">-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                </tr>-->
<!--                <tr class="white-row">-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                </tr>-->
<!--              </tbody>-->
<!--            </table>-->
            <el-table
                ref="singleTableRef"
                :data="tableData"
                highlight-current-row
                style="width: 100%; max-height: 220px; overflow: auto;margin-bottom: 10px;"
                @row-click="rowclick1"
            >
              <el-table-column type="index" width="50" label="序号" stripe style="width: 100%" />
              <el-table-column property="imageName" label="图形名" width="120" />
              <el-table-column property="time" label="生成时间" />
              <el-table-column label="操作">
            <template #default="{ row }">
              <el-button type="danger" @click="handleDelete(row)">删除图像</el-button>
            </template>
          </el-table-column>
            </el-table>
            <!-- 按钮 -->
            <!-- <div class="action-buttons">
              <el-button type="primary">删除图像</el-button>
              <el-button type="primary">加入数据集</el-button>
            </div> -->
          </div>
        </div>
      </div>

       
      </el-row>
    </div>
    <!-- 第三行 -->
    <div>
      <el-row>
        <div class="first-box">
        <div class="box-title">
          3.图像生成参数设置
        </div>
        <div>
          <div class="laber">
    <div class="input-columns">
      <div class="input-column">
        <div class="input-container">
          <label class="input-lable">数据集</label>
            <select class="model-select-data">
              <option value="DAGA" selected>DAGA</option>
              <option value="AAPD" >AAPD</option>
              <option value="KolektorSDD2" >KolektorSDD2</option>
              <option value="MTD" >MTD</option>
           
          </select>
        </div>
       
        <div class="input-container">
          <label class="input-lable">训练次数</label>
          <div class="input-box">
            <input type="text"  class="input-field" placeholder="500">
          </div>
        </div>
        <div class="input-container">
          <label class="input-lable">Bath size</label>
          <div class="input-box">
            <input type="text"  class="input-field" placeholder="32">
          </div>
        </div>
      </div>
      <div class="input-column">
        <div class="input-container">
          <label class="input-lable">生成模型</label>
          <select class="model-select-data">
              <option value="Cyclegan" selected>cyclegan</option>
              <option value="Pix2pix" >Pix2pix</option>
              <option value="Stylegan" >Stylegan</option>
           
          </select>
        </div>
        <div class="input-container">
          <label class="input-lable">学习率</label>
          <div class="input-box">
            <input type="text"  class="input-field" placeholder="0.001">
          </div>
        </div>
        <div class="input-container">
          <label class="input-lable">生成张数</label>
          <div class="input-box">
            <input type="text"  class="input-field" placeholder="200">
          </div>
        </div>
      </div>
    </div>
  </div>
        </div>
         <el-button type="success" @click="onclick2">生成模型</el-button>
       </div>
       <!-- 第二个 -->
      <div class="second-box">
        <div class="box-title">
          4. 生成图像筛选
        </div>
        <div class="detailed-content">
          <!-- 左侧部分，占据2/5 -->
          <div class="left-content">
            <div>
              <div class="box-blue3" style="margin-top: 40px;"> 
              <img style="width: 200px;height: 200px;
  margin: 10px 40px;"   :src="url2" />
              <!-- <img class="inner-button2" :src="selectedImageUrl" /> -->
            </div>
            <div class="box-title" style="margin-top: 40px;" >
              生成图像展示
            </div>
          </div>
          </div>
          <!-- 右侧部分，占据3/5 -->
          <div class="right-content">
            <!-- 第一行，水平居中显示的图像生成记录 -->
            <div class="box-title">
              图像生成记录
            </div>
            <!-- 表格 -->
<!--            <table class="image-table">-->
<!--              <thead>-->
<!--                <tr class="deep-blue-row">-->
<!--                  <th>序号</th>-->
<!--                  <th>图像名</th>-->
<!--                  <th>生成时间</th>-->
<!--                </tr>-->
<!--              </thead>-->
<!--              <tbody>-->
<!--                &lt;!&ndash; 三行空着 &ndash;&gt;-->
<!--                <tr></tr>-->
<!--                <tr></tr>-->
<!--                <tr></tr>-->
<!--                &lt;!&ndash; 表头为蓝色，下面一行蓝色一行白色的间隔颜色，内容为空 &ndash;&gt;-->
<!--                <tr class="blue-row">-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                </tr>-->
<!--                <tr class="white-row">-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                </tr>-->
<!--                <tr class="blue-row">-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                </tr>-->
<!--                <tr class="white-row">-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                  <td></td>-->
<!--                </tr>-->
<!--              </tbody>-->
<!--            </table>-->
            <!-- 按钮 -->
            <el-table
                ref="singleTableRef"
                :data="tableData2"
                highlight-current-row
                style="width: 100%; max-height: 220px; overflow: auto;margin-bottom: 10px;"
                @row-click="rowclick2"
            >
              <el-table-column type="index" width="50" label="序号" stripe style="width: 100%" />
              <el-table-column property="imageName" label="图形名" width="120" />
              <el-table-column property="time" label="生成时间" />
              <el-table-column label="操作">
                <template #default="{ row }">
                  <el-button type="danger" @click="handleDelete2(row)">删除图像</el-button>
                </template>
              </el-table-column>
            </el-table>
            <!-- <div class="action-buttons">
              <el-button type="primary">删除图像</el-button>
              <el-button type="primary">加入数据集</el-button>
            </div> -->
          </div>
        </div>
      </div>

       
      </el-row>
    </div>
  </div>
</template>
<script setup>
import { ref } from 'vue'
import { ElTable } from 'element-plus'
import {
  getTab0List,
  getTab0Submit,
  tab2_1_image_list,
  tab2_imgs_image_list,
  tab2_main1Submit,
  tab2_main2Submit
} from "@/api/index.js"
const tableData = ref([])
const tableData2 = ref([])
const url1 = ref('')
const url2 = ref('')


const rowclick2=(row)=>{
  console.log(row)
  url2.value = "/api/tab2/img2_download/"+row.imageName
}
const rowclick1=(row)=>{
  console.log(row)
  url1.value = "/api/tab2/1_download/"+row.imageName
}

const handleDelete = (row) => {
  const index = tableData.value.findIndex(item => item.imageName === row.imageName)
  if (index !== -1) {
    tableData.value.splice(index, 1)
  }
}

const handleDelete2 = (row) => {
  const index = tableData2.value.findIndex(item => item.imageName === row.imageName)
  if (index !== -1) {
    tableData2.value.splice(index, 1)
  }
}

const onclick1 =()=>{
  tab2_main1Submit()
  load()
}

const onclick2 =()=>{
  tab2_main2Submit()
  load2()
}

//加载列表
const load = ()=>{
  tab2_1_image_list().then(res=>{
    tableData.value = res
    console.log(res)

  })
}


const load2 = ()=>{
  tab2_imgs_image_list().then(res=>{
    tableData2.value=res
    console.log(res)
  })
}

</script>

<style scoped>
.body-content{
  /* max-height: calc(100vh - 90px); */
}
.title{
  font-size: 19px;
  font-weight: 400;
  margin:10px
}
.line{
  margin-bottom: 1px;
}
::v-deep .el-step__head.is-finish {
    color: #1a1b1d;
    border-color: #2a2c2f;
}
::v-deep .el-step__title.is-finish {
  color: #1a1b1d;
}
.box-title{
  font-size: 16px;
  font-weight: 600;
  margin:10px;
  text-align:center
}
.first-box{
  border: gray solid 1px;
  /* min-width: 300px; */
  margin:15px; 
}
.box-blue {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #5b9bd5;
  width: 200px;
  height: 200px;
}
.box-blue2 {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #5b9bd5;
  width: 400px;
  height: 200px;
  margin: 10px 40px;
}
.box-blue3{
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #80578379;
  width: 200px;
  height: 200px;
  margin: 10px 40px;
}

.inner-button {
  width: 60px;
  height: 30px;
  background-color: aliceblue;
  display: flex;
  justify-content: center;
  align-items: center;
}
.inner-button2{
  color: white;
  font-size: 30px;
}
.second-box{
  margin:15px; 
  border: gray solid 1px;
  /* min-width: 300px; */
}
.input-container {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.label {
  margin-right: 10px; 
}

.input-box {
  justify-content: center;
  align-items: center;
  display: flex;
  align-items: center;
  margin-left: 20px;
}

.input-field {
  width: 80px; /* 根据需要调整宽度 */
  padding: 5px;
  height: 25px;
  box-sizing: border-box;
  text-align: center;
}
.input-field2 {
  width: 40px; /* 根据需要调整宽度 */
  padding: 5px;
  height: 25px;
  box-sizing: border-box;
  text-align: center;
  margin-right:5px
}
  .input-field3 {
  width: 50px; /* 根据需要调整宽度 */
  padding: 5px;
  height: 25px;
  box-sizing: border-box;
  text-align: center;
  margin-left: 5px;
  }
.laber{
  margin-left: 35px;
}
.third-box{
  margin:10px; 
  border: gray solid 1px;
  /* min-width: 600px; */
  display: flex;
  flex-direction: column;
  align-items: center;
}
.begin{
  border: black solid 1px;;
  width: 80px;
  height: 30px;
  background-color: aliceblue;
  display: flex;
  justify-content: center;
  text-align:center;
  left: 50%;
  margin-top: 30px;
  
}

.row-container {
  display: flex;
  justify-content: space-between;
  margin: 0 -10px; /* 调整整体的 margin */
}

.first-box,
.second-box,
.third-box {
  flex: 1;
  margin:  10px; /* 调整每个盒子的 margin */
  display: flex;
  flex-direction: column;
  align-items: center;
}
.generation-options {
  display: flex;
  align-items: center;
}

.model-select {
  margin-right: 10px; /* 调整下拉框与按钮之间的间距 */
}
.model-select-data{
  /* margin-right: 10px; */
  width: 80px;
  margin-left: 20px; 

}
/* .begin {
  border: 1px solid black;
  padding: 5px 10px;
  cursor: pointer;
  background-color: aliceblue;
} */
.third-box {
  margin: 15px;
  border: gray solid 1px;
  min-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.detailed-content {
  display: flex;
  width: 100%;
}

.left-content {
  width: 40%; /* 占据2/5 */
  display: flex;
  justify-content: center;
  align-items: center;
  
}

.right-content {
  width: 60%; /* 占据3/5 */
}



.image-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

th, td {
  border: 1px solid white;
  text-align: center;
  padding: 8px;
}

.deep-blue-row {
  background-color: #5b9bd5;
  color: white;
  height: 30px; 
}
.blue-row {
  background-color: #d2deef;
  color: white;
  height: 30px; 
}

.white-row {
  background-color: white;
  height: 30px; 
}

.action-buttons {
  display: flex;
  justify-content: right;
}

.delete-button,
.addToDatabase-button {
  border: 1px solid black;
  padding: 5px 10px;
  cursor: pointer;
  background-color: aliceblue;
  margin:10px;
}
.input-columns {
  display: flex;
  justify-content: space-between;
}

.input-column {
  flex: 1;
  margin-right: 20px; /* 调整间距根据需要 */
}
.input-lable{
  width: 70px;
}
</style>
